package com.example.sxmall.service.action.impl;

import com.example.sxmall.auth.Authentication;
import com.example.sxmall.auth.UserInfo;
import com.example.sxmall.controller.shopCart.vo.ShopCartVO;
import com.example.sxmall.redis.ShopCartKey;
import com.example.sxmall.service.action.ActionCartService;
import com.example.sxmall.service.dto.OperateCartDTO;
import org.springframework.stereotype.Service;

/**
 * @Description: 清空购物车
 * @Author whh-yt
 * @Date 2022/3/17 4:30 下午
 */
@Service
public class RemoveAllCartActionService extends ActionCartService {

    @Override
    public ShopCartVO execute(OperateCartDTO operateCartDTO) {
        UserInfo userInfo = Authentication.getUserInfo();
        redisService.delete(ShopCartKey.SHOP_CART_KEY,userInfo.getUnionId());
        return super.execute(operateCartDTO);
    }
}
